package cn.it62.pojo;

/**
 * @author zhenhuaShen
 * @version 1.0
 * @date 2019/7/31
 * @description cn.it62.pojo
 */
public class Plane extends Aircraft {

    public int people;
    public String company;

    /**
     * 有参构造
     *
     * @param planeName
     * @param oil
     * @param voyage
     * @param people
     * @param company
     */
    public Plane(String planeName, int oil, int voyage, int people, String company) {
        super(planeName, oil, voyage);
        setPeople(people);
        setCompany(company);
    }

    public int getPeople() {
        return people;
    }

    public void setPeople(int people) {
        if (people < 100) {
            System.out.println("载客量不低于100");
            people = 100;
        }
        this.people = people;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }


    public void capacity() {
        System.out.println(getPlaneName() + "民航客机");
    }

    /**
     * toString方法
     *
     * @return
     */
    @Override
    public String toString() {
        return "Plane{" +
                "planeName='" + getPlaneName() + '\'' +
                ", oil=" + getOil() +
                ", voyage=" + getVoyage() +
                ",people=" + people +
                ", company='" + company + '\'' +
                '}';
    }
}
